package com.fqr;

import java.util.Map;

public class ToArgs {

	public static String[] toArgs(Map<String, String> map) {
		int size = 0;
		for (String key : map.keySet()) {
			String value = map.get(key);
			if (value == null || value.length() == 0)
				size++;
			else
				size += 2;
		}

		String[] args = new String[size];
		int i = 0;
		for (String key : map.keySet()) {
			args[i++] = "-" + key;
			String value = map.get(key);
			if (value == null || value.length() == 0)
				;// skip
			else
				args[i++] = value;

		}

		return args;
	}
}
